<?php
namespace app\common\model\jiyun;

use app\common\model\collect\OrderExpressModel;
use think\admin\Model;


/**
 * 订单模型
 * @package app\common\model\shop
 * @author Lhognqi
 * @DateTime 2024-10-22 11:30:38
 */
class OrderModel extends Model
{

    // 设置当前模型对应的完整数据表名称
    protected $name = 'jiyun_order';

    // 自动写入时间戳
    protected $autoWriteTimestamp = false;

    const STATUS_NO_IN    = 0; // 带入库
    const STATUS_HAS_NO   = 1; // 已入库
    const STATUS_PACKING  = 2; // 集包中
    const STATUS_NO_SENT  = 3; // 待发货
    const STATUS_HAS_SENT = 4; // 已发货
    const STATUS_SIGN_FOR = 5; // 已签收


    /**
     * 日志名称
     * @var string
     */
    protected $oplogName = '集运订单管理';

    /**
     * 日志类型
     * @var string
     */
    protected $oplogType = '渠道订单管理';

    /**
     * 状态
     * @var array
     * */
    public static function status()
    {
        return [
            0 => lang("待入库"),
            1 => lang("已入库"),
            2 => lang("集包中"),
            3 => lang("待发货"),
            4 => lang("已发货"),
            5 => lang("已签收"),
        ];

    }

    // 关联拣货单
    public function orderpacking()
    {
        return $this->hasMany(OrderPackingModel::class,'jiyun_order_id');
    }

    // 关联包裹
    public function orderexpress()
    {
        return $this->hasMany(OrderExpressModel::class,'jiyun_order_id');
    }



}